﻿Imports System.ComponentModel
Imports SACommon

<ToolboxItem(False)>
Public Class ucStart
    Private mGotoNextPage As Boolean
    Private Sub ucStart_Load(sender As Object, e As EventArgs) Handles Me.Load
        btnAction.Visible = False
        lblProgress.Visible = False
        If MyApp.DesignMode = False Then
            NonDesignMode()
        Else
            IsDesignMode()
        End If
    End Sub
    Sub IsDesignMode()
        lblMessage.Text = "Design Mode"
        mGotoNextPage = False
    End Sub
    Sub NonDesignMode()
        mGotoNextPage = True
        'Check for connection and stop
        If UpdateCore.Connected(True) = False Then
            lblProgress.Visible = True
            lblMessage.Text = String.Format("Please connect to the internet to install {0}.", MyApp.ApplicationTitle)
            lblProgress.Text = MyApp.ApplicationTitle & " can not be installed."
            btnAction.Visible = True
            mGotoNextPage = False
        End If
    End Sub
    Private Sub ucStart_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
        If mGotoNextPage = False Then Exit Sub
        Application.DoEvents()
        gApp.ChangePage(MyApp.ApplicationType.Download, True)
    End Sub
    Private Sub btnAction_Click(sender As Object, e As EventArgs) Handles btnAction.Click
        gApp.ChangePage(MyApp.ApplicationType.EndApplication, True)
    End Sub
End Class
